package com.asia5b.a5mall.member.activity.comment

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.asia5b.a5bmall.resource.ActCons
import com.asia5b.a5mall.member.R
import com.asia5b.a5mall.member.databinding.ActivityCommentlistBinding
import com.asia5b.a5mall.member.fragment.CommentListFragment
import com.asia5b.a5mall.middleware.base.SimpleActivity
import com.asia5b.a5mall.middleware.base.SimpleViewModel
import com.asia5b.a5mall.middleware.base.BaseFragmentPagerAdapter
import com.asia5b.a5mall.middleware.utils.sNewStanceFragment
import kotlinx.android.synthetic.main.activity_commentlist.*

/**
 * Created by zhangyuncai on 2019/12/21.
 * @Note   评论中心
 */
@Route(path = ActCons.CommentListActivity)
class CommentListActivity : SimpleActivity<SimpleViewModel, ActivityCommentlistBinding>() {

    override val viewModelClazz: Class<SimpleViewModel>
        get() = SimpleViewModel::class.java

    override fun getDataBinding(): ActivityCommentlistBinding {
        return ActivityCommentlistBinding.inflate(layoutInflater)
    }
    override var sIsDark = true
    val tab by lazy { tab_comments }
    val mViewPager by lazy { vp_comments }
    val tabTexts by lazy{
        arrayListOf<String>(
                getString(R.string.待评价),
                getString(R.string.待追评),
                getString(R.string.已评价)
        )
    }
    val list = arrayListOf<Fragment>()

    override fun initView() {
        list.clear()
        for (i in 1..3) {
            var bundle = Bundle()
            bundle.putInt("type", i)
            list.add(sNewStanceFragment(mActivity, CommentListFragment::class.java, bundle))
        }
        val pagerAdapter = BaseFragmentPagerAdapter(supportFragmentManager, list, tabTexts)
        mViewPager.adapter = pagerAdapter
        mViewPager.offscreenPageLimit=list.size
        tab.setupWithViewPager(mViewPager)
    }

    override fun initEvent() {
    }
    override fun initData() {

    }
}